/**
*      author: Y_Yao
*      created: 2024-09-14 19:11:43
**/

#include<bits/stdc++.h>

using namespace std;

void solve()
{
    int a , b;
    cin >> a >> b;
    cout<< b - a <<endl;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 0;
    cin >> t;
    while(t--)
    {
        solve();
    } 
    return 0;
}